import React from "react";
import { useLocation, useHistory } from "react-router-dom";

import "./index.less";

const list = [
  { path: "/logisticsSecurity", name: "后勤保障处" },
  { path: "/logisticsSecurity1", name: "保卫处" },
  { path: "/logisticsSecurity2", name: "基建处" },
  { path: "/logisticsSecurity3", name: "余区管委会" },
  { path: "/logisticsSecurity4", name: "校医院" },
  { path: "/logisticsSecurity5", name: "后勤集团" },
  { path: "/logisticsSecurity6", name: "网络信息中心" },
]

const App = () => {

  // 存储当前路由地址
  const { pathname } = useLocation();
  // 跳转路由
  const history = useHistory();

  // useEffect(() => {
  // // eslint-disable-next-line
  // }, []);

  return (
    <div className="app-footer">
      {
        list.map((item) => (
          <div 
            className={ item.path === pathname ? "select footer": "footer"} 
            key={item.path}
            onClick={() => history.push(item.path)}
          >
            { item.name }
          </div>
        ))
      }
    </div>
  );
}

export default App;


